<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <base href="#(basePath)"/>
  <title>交易管理 - 应收账款</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="static/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="static/admin.css" media="all">
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">用户号</label>
            <div class="layui-input-inline">
              <input type="text" name="merchCode" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">钱包订单号</label>
            <div class="layui-input-inline">
              <input type="text" name="orderNo" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-input-inline">
              <input type="text" class="layui-input" id="createTimeStart" name="createTimeStart" placeholder="yyyy-MM-dd HH:mm:ss">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-input-inline">
              <input type="text" class="layui-input" id="createTimeEnd" name="createTimeEnd" placeholder="yyyy-MM-dd HH:mm:ss">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
              <select name="orderStatus" lay-filter="orderStatus" >
                <option value="">请选择</option>
                #for(item : orderStatusList)
                <option value="#(item.code)">#(item.name)</option>
                #end
              </select>
            </div>
          </div>

            <div class="layui-inline">
                <label class="layui-form-label">交易类型</label>
                <div class="layui-input-inline">
                    <select name="bizType" multiple="multiple" lay-filter="bizType">
                        <option value="">请选择</option>
                        #for(item : bizTypeList)
                        <option value="#(item.code)">#(item.name)</option>
                        #end
                    </select>
                </div>
            </div>


          <div class="layui-inline">
            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-web-list-search">
              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
            </button>
          </div>
        </div>
      </div>

      <div class="layui-card-body">
      	<div style="padding-bottom: 10px;">
        </div>
        <table id="LAY-web-list" lay-filter="LAY-web-list"></table>
        <script type="text/html" id="table-content-list">
		#[[ {{#  if(d.orderStatus == 'R1'){ }} ]]#
		#auth()
			<a link="admin/pay/firstReviewPage" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="firstReview"><i class="layui-icon layui-icon-edit"></i>一审</a>
		#end
		#[[ {{#  } }} ]]#

		#[[ {{#  if(d.orderStatus == 'R2'){ }} ]]#
		#auth()
			<a link="admin/pay/secondReviewPage" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="secondReview"><i class="layui-icon layui-icon-edit"></i>二审</a>
		#end
		#[[ {{#  } }} ]]#

		#[[ {{#  if(d.orderStatus == 'R3'){ }} ]]#
		#auth()
			<a link="admin/pay/thirdReviewPage" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="thirdReview"><i class="layui-icon layui-icon-edit"></i>三审</a>
		#end
		#[[ {{#  } }} ]]#

		#[[ {{#  if(d.orderStatus == 'WT'){ }} ]]#
		#auth()
			<a link="admin/pay/transferOutReviewPage" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="transferOutReviewPage"><i class="layui-icon layui-icon-edit"></i>待打款</a>
		#end
		#[[ {{#  } }} ]]#

		#[[ {{#  if(d.orderStatus=='TS'){ }} ]]#
		#auth()
			<a link="admin/pay/certificate" class="layui-btn layui-btn-xs" lay-event="certificate"><i class="layui-icon layui-icon-auz"></i>回执</a>
		#end
		#[[ {{#  } }} ]]#
        </script>
      </div>
    </div>
  </div>

  <script src="static/layui/layui.js"></script>
  <script>
  layui.config({
    base: '#(basePath)' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'laydate', 'table', 'multiSelect',   'payOrder'], function(){
	var laydate = layui.laydate, multiSelect = layui.multiSelect;
    //日期时间选择器
    laydate.render({
      elem: '#createTimeStart'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#createTimeEnd'
      ,type: 'datetime'
    });

    // 表格
    var table = layui.table
    ,form = layui.form;

    //监听搜索
    form.on('submit(LAY-web-list-search)', function(data){
      var field = data.field;

        // var checkStatus = table.checkStatus('idOrderList'); //idTest 即为基础参数 id 对应的值
        // console.log(checkStatus.data); //获取选中行的数据
        // console.log(checkStatus.data.length); //获取选中行数量，可作为是否有选中行的条件
        // console.log(checkStatus.isAll ); //表格是否全选

        field.bizType2="33355";
        field.bizTypex="";
        console.log(field);

        var vals = [],
            texts = [];
        var tt = 1;
        $('select[multiple] option:selected').each(function() {
            field.bizTypex += $(this).val() + ";";
            vals.push($(this).val());
            texts.push($(this).text());
        });
        console.dir(vals);
        console.dir(texts);


      //执行重载
      table.reload('LAY-web-list', {
        where: field,
        page: {curr: 1}
      });
    });


      //判断字符是否为空的方法
      function isEmpty(obj){
          if(typeof obj == "undefined" || obj == null || obj == ""){
              return true;
          }else{
              return false;
          }
      }
    var $ = layui.$,
    active = {
      add: function(){
  		parent.layer.open({
          type: 2
          ,title: '添加'
          ,content: 'admin/pay/addPage'
          ,maxmin: true
          ,area: ['80%', '90%']
          ,btn: ['确定', '取消']
          ,yes: function(index, layero){
             //点击确认触发 iframe 内容中的按钮提交
             layero.find('iframe').contents().find("#layuiadmin-app-form-submit").click();
           }
        });
      }
    };

    $('.layui-btn.layuiadmin-btn-list').on('click', function(){
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });
  });
  </script>
</body>
</html>
